package adapter;/*
 *@创建者 lnn
 *@创建时间2016/8/3117:32
 *@描述 ${TODO}
*/

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.util.List;

public class HeadAdapter extends PagerAdapter {
    private List<ImageView> mData;

    public HeadAdapter(List<ImageView> data) {
        mData = data;
    }

    @Override
    public int getCount() {
        return mData == null ? 0 : mData.size();
    }


    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView imageView = mData.get(position);
        container.addView(imageView);
        return mData.get(position);

    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mData.get(position));
    }


}
